import React, { useCallback } from 'react'
import _http from '@/_http'

export default function Setting() {
  const updateStatus = useCallback(async (status) => {
    const res = await _http('/system/updatestatus', { 
      user: 'glack',
      key: 'JHIJfdswqefsdDfro21gmdsl2',
      status
     }, 'POST')
    if (res.data.code === 1) {
      alert('操作成功' + status)
    }
  }, [])
  return (
    <div>
      <button onClick={() => updateStatus('online')}>上线</button>
      <button onClick={() => updateStatus('offline')}>下线</button>
    </div>
  )
}
